package com.ccnf.core.exception;

import com.ccnf.core.bean.StatusCode;
import lombok.Data;

/**
 * 业务处理相关的异常抛出，所有的异常都继承该异常
 */
@Data
public class BizException extends RuntimeException {
    private Integer errorCode;

    public BizException(String message) {
        this(StatusCode.BIZ_OPERATION_FAILURE.getCode(), message);
    }

    public BizException(Integer errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public BizException(StatusCode statusCode, String message) {
        super(message);
        this.errorCode = statusCode.getCode();
    }
}
